<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html class="pixel-ratio-2 retina android android-6 android-6-0">
<head>
<title>游戏代理后台</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
	content="width=device-width, initial-scale=1, user-scalable=no">

<meta name="description" content="">

<link rel="stylesheet" href="${ctx }/templates/default/skins/default/h5/lib/weui.min.css">
<link rel="stylesheet" href="${ctx }/templates/default/skins/default/h5/css/jquery-weui.css">
<link rel="stylesheet" href="${ctx }/templates/default/skins/default/h5/css/lehe.css">
<script type="text/javascript">
	navigator
			.__defineGetter__(
					'userAgent',
					function() {
						return 'Mozilla/5.0 (Linux; U; Android 2.3.6; zh-cn; GT-S5660 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 MicroMessenger/4.5.255';
					});
</script>
</head>

<body ontouchstart="">
	<heaer>
	<div class="header">
		<a href="javascript:history.go(-1);" class="title"> <span
			class="header-icon4"></span>
		</a> <span class="title-txt J-title-txt">玩家充值</span>
	</div>
	<div class="header-secondary"></div>
	</heaer>

	<div id="list" class="lehe-content-padded">
	</div>

	<div id="loading" class="weui-loadmore" style="display: none;">
		<i class="weui-loading"></i><span class="weui-loadmore__tips">正在加载</span>
	</div>

	<script src="${ctx }/templates/default/skins/default/h5/lib/jquery-2.1.4.js"></script>
	<script src="${ctx }/templates/default/skins/default/h5/lib/fastclick.js"></script>
	<script>
		$(function() {
			FastClick.attach(document.body);
		});
	</script>
	<script src="${ctx }/templates/default/skins/default/h5/js/jquery-weui.js"></script>


	<script>
		var ctx = "${ctx}";
		var dataUrl = "/wx/playerPayDetailListData";
		$(function() {
			FastClick.attach(document.body);
		});
		var defaultImg = "https://res.wx.qq.com/a/wx_fed/common_assets/16120602/win_weixin21/images/phone_logo2x.png";
		var page = 1;
		var pagesize = 10;
		var loading = false;
		$("#loading").hide();

		loadPages();

		$(document.body).infinite().on("infinite", function() {
			loadPages();
		});

		function loadPages() {
			if (loading)
				return;
			loading = true;
			$("#loading").show();
			$.post(ctx+dataUrl,{
					page : page,
					pagesize : pagesize,
					btime:"${btime}",
					etime:"${etime}"
				},function(result){callback(result);}
			);
		}
		
		function callback(result) {
			var data = result;
			var row = data;
			var l = row.length;
			if (l > 0) {
				page++;
				$("#list #nomore").remove()
			} else {
				var nodataTip = '<div id="nomore" class="weui-loadmore weui-loadmore_line">'
						+ '<span class="weui-loadmore__tips">没有更多数据了</span>'
						+ '</div>';
				$("#loading").hide();
				$("#list").append(nodataTip);
				return;//没有下一夜数据了，没有设置loading为false，保证下次触发翻页时不再加载数据
			}
			for (var i = 0; i < l; i++) {
				var rs = row[i];
				var allCount = parseFloat(rs.myPayCount) + parseFloat(rs.myGoldPayCount);
				if(rs.myPayCount>0){
                    $("#list").append(
                        "<form id='f"+rs.userId+"' action='${ctx }/wx/userPayDetailList'>"+
                        "<input type=hidden name=btime value='${result.btime}'>"+
                        "<input type=hidden name=etime value='${result.etime}'>"+
                        "<input type=hidden name=userId value='"+rs.userId+"'>"+
                        "</form>"+
                        '<a class="weui-cell weui-cell_access" href="javascript:f'+rs.userId+'.submit();"> '
                        + '<div class="weui-cell__hd"><img onerror="onerror=null;src=\''+defaultImg+'\'" class="head_image" src="' + (rs.userImg==null?defaultImg:rs.userImg) + '" style="width:64px;height:64px;margin-right:5px;display:block"></div> '
                        + '<div class="weui-cell__bd"> <p>'
                        + rs.nickName
                        + '</p> <p><span class="lehe-sub-title-info">'
                        + rs.userId
                        + '<span></p> </div> '
                        + '<div class="weui-cell__ft">'
                        + '<p>总充值：'+ allCount.toFixed(2) + '元</p>'
                        + '<p>金币总充值：'+ rs.myGoldPayCount+ '元</p>'
                        + '<p>微信总充值：'+ rs.myPayCount+ '元</p>'
                        + '</div> </a>');
                }else {
                    $("#list").append(
                        "<form id='f"+rs.userId+"' action='${ctx }/wx/userPayDetailList'>"+
                        "<input type=hidden name=btime value='${result.btime}'>"+
                        "<input type=hidden name=etime value='${result.etime}'>"+
                        "<input type=hidden name=userId value='"+rs.userId+"'>"+
                        "</form>"+
                        '<a class="weui-cell weui-cell_access" href="javascript:f'+rs.userId+'.submit();"> '
                        + '<div class="weui-cell__hd"><img onerror="onerror=null;src=\''+defaultImg+'\'" class="head_image" src="' + (rs.userImg==null?defaultImg:rs.userImg) + '" style="width:64px;height:64px;margin-right:5px;display:block"></div> '
                        + '<div class="weui-cell__bd"> <p>'
                        + rs.nickName
                        + '</p> <p><span class="lehe-sub-title-info">'
                        + rs.userId
                        + '<span></p> </div> '
                        + '<div class="weui-cell__ft">'
                        + '<p>总充值：'+ allCount.toFixed(2) + '元</p>'
                        + '<p>金币总充值：'+ rs.myGoldPayCount+ '元</p>'
                        + '</div> </a>');
                }

			}
			$("#loading").hide();
			loading = false;
		}
	</script>
</body>
</html>